﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Mole
{
    [Serializable]
    public class UrlProcessed : INotifyPropertyChanged
    {
        private uint _SiteId;
        private Boolean _Complete;
        private Uri _Url;
        private DateTime _ScanTime;
        private String _Directory;

        public uint SiteId
        {
            get { return _SiteId; }

            set
            {
                _SiteId = value;
                this.NotifyPropertyChanged("SiteID");

            }
        }
        public Boolean Complete
        {
            get { return _Complete; }

            set
            {
                _Complete = value;
                this.NotifyPropertyChanged("Complete");

            }
        }
        public String Url
        {
            get { return _Url.OriginalString; }

            set
            {
                _Url = new Uri(value);
                this.NotifyPropertyChanged("Url");
            }
        }
        public DateTime ScanTime
        {
            get { return _ScanTime; }

            set
            {
                _ScanTime = value;
                this.NotifyPropertyChanged("ScanTime");
            }
        }
        public String Directory
        {
            get { return _Directory; }

            set
            {
                _Directory = value;
                this.NotifyPropertyChanged("Directory");
            }
        }


        public event PropertyChangedEventHandler PropertyChanged;

        internal UrlProcessed()
        {
        }

        public UrlProcessed(uint siteId, Boolean complete, String url, DateTime scanTime, String directory)
        {
            SiteId = siteId;
            Complete = complete;
            Url = url;
            ScanTime = scanTime;
            Directory = directory;
        }
        
        private void NotifyPropertyChanged(String name)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(name));
            }
        }
    }
}
